package com.zlsy.es.dianping.controller;

import com.zlsy.es.dianping.base.R;
import com.zlsy.es.dianping.pojo.model.Category;
import com.zlsy.es.dianping.service.CategoryService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


/**
 * @author zhouliang
 */
@Controller
@RequestMapping("/category")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CategoryIndexController {

    private final CategoryService categoryService;

    @ResponseBody
    @RequestMapping("/list")
    public R<List<Category>> list() {
        return R.success(categoryService.selectAll());

    }

}
